//
//  ViewController.swift
//  StudyChinese
//
//  Created by Wenzhe Fan on 2019/6/19.
//  Copyright © 2019年 Wenzhe Fan. All rights reserved.
//

import UIKit
import AVFoundation

let url:URL = Bundle.main.url(forResource: "studyhanzi", withExtension: "plist")!
let soureHanziReader:NSDictionary = NSDictionary.init(contentsOf: url)!

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
       debugPrint(soureHanziReader)
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    
    @IBAction func aboutUSInMainVC(_ sender: UIButton) {
        let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "AboutUSViewController") as! AboutUSViewController
        self.navigationController?.pushViewController(pinVC, animated: true)
    }
    
    @IBAction func listenHanzi(_ sender: UIButton) {
        debugPrint("跟踪")
    }
    @IBAction func button(_ sender: UIButton) {
        switch sender.tag {
        case 1000: //帮助
           let alertVC = UIAlertController.init(title: "温馨提示", message: "使用方法\n\n 1.单击进入内部学习\n\n2.双击听读音", preferredStyle: .alert)
           let actionOK = UIAlertAction.init(title: "👌", style: .default) { act in
            
           }
           alertVC.addAction(actionOK)
           present(alertVC, animated: true, completion: nil)
        
            break
        case 1001: // 学习拼音
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PingYinVC")
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1002: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["一","二","三","四","五"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1003: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["你","我","他","它","她","爸",
                              "妈","兄","弟","姐","妹","叔",
                              "婶","爷","奶","弟","父","子",
                              "舅","姑","男","女","老","少",]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1004: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["上","下","左","右","中",
                              "东","西","南","北","前",
                              "后","侧","内","外","顶",
                              "底","高","矮","胖","瘦"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1005: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["鼠","牛","虎","兔","龙",
                              "蛇","马","羊","猴","鸡",
                              "狗","猪","象","鹿","鹰",
                              "狼","鲸","蛙","鳄","鱼"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1006: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["赵","钱","孙","李",
                              "周","吴","郑","王",
                              "冯","陈","褚","卫",
                              "蒋","沈","韩","阳",
                              "朱","秦","尤","许"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1007: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["碗","锅","盆","碟","筷",
                              "勺","瓢","盖","杯","缸",
                              "衣","裙","袍","褂","鞋",
                              "袜","门","锁","镜","梳",
                              "窗","席","帘","灯","蜡",
                              "烛","台","被","枕","睡",]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1008: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["桃","杏","桔","橙","梨","枣",
                              "花","梅","兰","竹","菊","槐",
                              "肉","菜","蛋","油","米","面",
                              "盐","酸","辣","哭","甜",
                              "涩","香","麻","酥","脆"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1009: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["手","脚","臂","腿","拳",
                              "掌","脸","头","鼻","耳",
                              "眼","嘴","牙","舌","口",
                              "喉","发","胸","背","指",
                              "甲","乙","丙","丁","戊",
                              "躺","坐","靠","跑","跳",
                              "抓","挠","说","笑","哭",
                              "悲","欢","离","合","风",
                              "雨","雷","电","雪","雾",
                              "露","冰","阴","晴","圆","缺"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1010: // 5个字
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
//            道可道，非常道；名可名，非常名。
//            无名，天地之始，有名，万物之母。
//            故常无欲，以观其妙，常有欲，以观其徼。
//            此两者，同出而异名，同谓之玄，玄之又玄，众妙之门
            pinVC.hanziArr = ["椅","桌","凳","架","床","灶","灭","火","器","箱",
                              "包","树","杨","槐","桐","柳","榆","衫","桦","柏",
                              "松","楸","桩","苗","核","牙","针","线","路","泣",
                              "吹","拉","弹","说","昌","吃","喝","拉","撒","吐",
                              "忠","孝","仁","义","礼","挂","帖","摘","送","收",
                              "沐","浴","温","泉","山","水","江","河","湖","泽",
                              "溪","渠","梁","沟","龛","佛","尼","僧","庙","院",
                              "爱","恨","情","仇","生","死","活","僧","庙","院",
            ]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1011: // 常用语
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            pinVC.type = .多字
            pinVC.hanziArr = ["抬头","挺胸","收腹","提臀","军姿"]
            pinVC.englishArr = ["Head up", "chest up", "belly up", "hip up", "military posture"]
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1012: // 问候语
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
            pinVC.hanziArr = ["早","早上好","晚上好","吃饭了吗","睡的怎么样",
                              "你今天看起来很精神","别发疯"]
            pinVC.englishArr = ["Morning", "Good morning", "Good evening",
                                "Have you eaten", "How's your sleep?",
                "You look energetic today.","Don't go mad."]
            pinVC.type = .多字
            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1013: // 交通工具
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            pinVC.type = .多字
            pinVC.hanziArr = ["汽车","马车","牛车","架子车","学步车",
                              "校车","火车","电车","飞机","轮船",
                              "货轮","自行车","代步车","电动车","电瓶车",
                              "摩托车","卡车","吉普","红旗","四轮机"
                              ]
            pinVC.englishArr = ["Cars", "carriages", "ox carts",
                                "shelf carts", "learning bicycles" ,
                                "School Bus", "Train", "Tram",
                                "Airplane","Ship" ,"Freight ship",
                                "Bicycle", "Substitute bicycle",
                                "Electric vehicle",
                                "Battery car","Motorcycle", "Truck",
                                "Jeep", "Red Flag", "Four Wheel Machine"]
            self.navigationController?.pushViewController(pinVC, animated: true)
        case 1014: // 购物常用语
            debugPrint("11")
            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            pinVC.type = .多字
            pinVC.hanziArr = ["买","卖","九折","一口价","团购",
                              "优惠券","批发价","零售价","折扣款","大甩卖",
                              "新店优惠","买一送二","满5减2","销量","好评",
                              "差评","骑手","美团","饿了么","外卖",
                              "堂吃","外送","预定","火锅","羊肉串",
                              "肉夹馍","北京烤鸭","臭豆腐","老干妈","大放送",
                              ]
            pinVC.englishArr = ["Buy", "Sell", "10% discount", "One-price",
                                "Group Purchase","Coupons", "Wholesale Price", "Retail Price", "Discount", "Big Sale","New store discount", "Buy one free two", "Full 5 minus 2", "Sales volume", "Good comments","Bad reviews", "Riders", "Mei Tuan", "Are you hungry",
                                "Take-out","Eat in the hall", "Delivery", "Reservation", "Hot pot", "Mutton kebab",
            "Meat with steamed buns", "Beijing roast duck", "stinky tofu", "old dry mother", "big release"]
            self.navigationController?.pushViewController(pinVC, animated: true)
        case 1015: // 三首唐诗
            debugPrint("11")
            let alertVC = UIAlertController.init(title: "唐诗", message: "欢迎学习", preferredStyle: .alert)
            let actionA = UIAlertAction.init(title: "《早发白帝城》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《早发白帝城》","朝辞白帝彩云间","千里江陵一日还","两岸猿声啼不住","轻舟已过万重山",]
                pinVC.englishArr = ["Baidi City of Early Falling","Among the clouds of Emperor Bai", "Qianli Jiangling returned one day", "The boat passed thousands of mountains with apes shouting without endless","The boat passed thousands of mountains with apes shouting without endless"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionB = UIAlertAction.init(title: "《黄鹤楼送孟浩然之广陵》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = [
                                  "《黄鹤楼送孟浩然之广陵》","故人西辞黄鹤楼","烟花三月下扬州。","孤帆远影碧空尽，","唯见长江天际流"]
                pinVC.englishArr = ["Huanghe Tower Sends Meng Haoran's Guangling","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible.","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible."]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionC = UIAlertAction.init(title: "《静夜思》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《静夜思》",
                                  "床前明月光","疑是地上霜","举头望明月","低头思故乡"]
                pinVC.englishArr = ["Quiet night thinking","The bright moonlight in front of the bed is suspected to be frost on the ground.","The bright moonlight in front of the bed is suspected to be frost on the ground","Raising my head, I see the moon so bright"," withdrawing my eyes, my nostalgia comes around",
                ]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionD = UIAlertAction.init(title: "《将进酒·君不见黄河之水天上来》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《将进酒·君不见黄河之水天上来》",
                                  "君不见黄河之水天上来，奔流到海不复回",
                                  "君不见高堂明镜悲白发，朝如青丝暮成雪",
                                  "人生得意须尽欢，莫使金樽空对月。",
                                  "天生我材必有用，千金散尽还复来。",
                                  "烹羊宰牛且为乐，会须一饮三百杯。",
                                  "岑夫子，丹丘生，将进酒，杯莫停。",
                                  "与君歌一曲，请君为我侧耳听。",
                                  "钟鼓馔玉不足贵，但愿长醉不复醒。",
                                  "古来圣贤皆寂寞，惟有饮者留其名。",
                                  "陈王昔时宴平乐，斗酒十千恣欢谑。",
                                  "主人何为言少钱，径须沽取对君酌。",
                                  "五花马，千金裘，",
                                  "呼儿将出换美酒，与尔同销万古愁"]
                pinVC.englishArr = ["Will Wine, Jun Can't See the Water of the Yellow River in Heaven",
                                    "You can't see the water of the Yellow River coming up from the sky, running to the sea and never returning. ",
                                    "You can't see the mirror in the lobby, grieving and white hair. It's as green as snow at dusk.",
                                    " Life must be full of joy. Don't make Jin Yuankong face to face with the moon. ",
                                    "Natural talent will be useful, thousands of gold scattered back. It takes 300 cups to cook sheep and slaughter cattle for pleasure. ",
                                    "Cen Fu Zi, Danqiusheng, will not stop drinking.",
                                    " Sing a song with you, please listen to it for me. ",
                                    "Zhonggu Xiaoyu is not expensive enough, I hope that long drunk will not wake up. ",
                                    "All sages and sages have been lonely since ancient times, but only drinkers have left their names. ",
                                    "In the past, King Chen enjoyed banquets and wine fights.",
                                    " Why does the owner say less money? ",
                                    "Five-colored horses, Qianjin Qiu ",
                                    "Huer will exchange fine wine and sell with Er for a long time"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionE = UIAlertAction.init(title: "《杂诗三首·其二》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《杂诗三首·其二》",
                    "君自故乡来,应知故乡事。","来日绮窗前，寒梅著花未？"]
                pinVC.englishArr = ["Three Miscellaneous Poems","When you come from your hometown, you should know about it.",
                                    " In front of the window of tomorrow, the plum blossoms are not yet blooming"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionF = UIAlertAction.init(title: "《九月九日忆山东兄弟》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《九月九日忆山东兄弟》",
                                  "独在异乡为异客，每逢佳节倍思亲。","遥知兄弟登高处，遍插茱萸少一人"]
                pinVC.englishArr = ["Remembering Shandong Brothers on September 9","Alone in a foreign country, I miss my relatives every festival."," Far-away brothers ascend the heights, less than one person inserts dogwood everywhere"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
          
            alertVC.addAction(actionA)
            alertVC.addAction(actionB)
             alertVC.addAction(actionC)
            alertVC.addAction(actionD)
            alertVC.addAction(actionE)
            alertVC.addAction(actionF)
            self.present(alertVC, animated: true, completion: nil)
            
            
//            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
            
//            pinVC.hanziArr = [
//
//                              "山中相送罢，日暮掩柴扉。春草年年绿，王孙归不归",
//                              "红豆生南国，春来发几枝。愿君多采撷，此物最相思",
//                              "渭城朝雨浥轻尘，客舍青青柳色新。劝君更尽一杯酒，西出阳关无故人",
//                              "独坐幽篁里，弹琴复长啸。深林人不知，明月来相照",
//                              "下马饮君酒，问君何所之。君言不得意，归卧南山陲。但去莫复问，白云无尽时"]
//            pinVC.englishArr = [
//                                "Alone in a foreign country, I miss my relatives every festival. Far-away brothers ascend the heights, less than one person inserts dogwood everywhere",
//                                "Let's see each other off in the mountains and hide our hearts at dusk. Spring grass grows green every year, but Wang Sun never returns",
//                                "Red beans grow in the South, sprouting a few branches in spring. May you gather more, this thing is most lovely",
//                                "Weicheng is facing the rain and light dust, and the guest houses are green and willow. Advising you to make a glass of wine, the west is out of the sun",
//                                "Sitting alone in the secluded cage, playing the piano and whistling again. People in Shenlin don't know that the moon will shine",
//                                "Get off your horse and drink your wine and ask where you are. Unfortunately, you lie in the southern border. But don't ask again, when the clouds are endless"]
//            pinVC.type = .唐诗
//            self.navigationController?.pushViewController(pinVC, animated: true)
        case 1016: // 宋词几首
            debugPrint("11")
            let alertVC = UIAlertController.init(title: "唐诗", message: "欢迎学习", preferredStyle: .alert)
            let actionA = UIAlertAction.init(title: "《早发白帝城》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《早发白帝城》","朝辞白帝彩云间","千里江陵一日还","两岸猿声啼不住","轻舟已过万重山",]
                pinVC.englishArr = ["Baidi City of Early Falling","Among the clouds of Emperor Bai", "Qianli Jiangling returned one day", "The boat passed thousands of mountains with apes shouting without endless","The boat passed thousands of mountains with apes shouting without endless"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionB = UIAlertAction.init(title: "《黄鹤楼送孟浩然之广陵》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = [
                    "《黄鹤楼送孟浩然之广陵》","故人西辞黄鹤楼","烟花三月下扬州。","孤帆远影碧空尽，","唯见长江天际流"]
                pinVC.englishArr = ["Huanghe Tower Sends Meng Haoran's Guangling","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible.","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible."]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionC = UIAlertAction.init(title: "《静夜思》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《静夜思》",
                                  "床前明月光","疑是地上霜","举头望明月","低头思故乡"]
                pinVC.englishArr = ["Quiet night thinking","The bright moonlight in front of the bed is suspected to be frost on the ground.","The bright moonlight in front of the bed is suspected to be frost on the ground","Raising my head, I see the moon so bright"," withdrawing my eyes, my nostalgia comes around",
                ]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionD = UIAlertAction.init(title: "《将进酒·君不见黄河之水天上来》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《将进酒·君不见黄河之水天上来》",
                                  "君不见黄河之水天上来，奔流到海不复回",
                                  "君不见高堂明镜悲白发，朝如青丝暮成雪",
                                  "人生得意须尽欢，莫使金樽空对月。",
                                  "天生我材必有用，千金散尽还复来。",
                                  "烹羊宰牛且为乐，会须一饮三百杯。",
                                  "岑夫子，丹丘生，将进酒，杯莫停。",
                                  "与君歌一曲，请君为我侧耳听。",
                                  "钟鼓馔玉不足贵，但愿长醉不复醒。",
                                  "古来圣贤皆寂寞，惟有饮者留其名。",
                                  "陈王昔时宴平乐，斗酒十千恣欢谑。",
                                  "主人何为言少钱，径须沽取对君酌。",
                                  "五花马，千金裘，",
                                  "呼儿将出换美酒，与尔同销万古愁"]
                pinVC.englishArr = ["Will Wine, Jun Can't See the Water of the Yellow River in Heaven",
                                    "You can't see the water of the Yellow River coming up from the sky, running to the sea and never returning. ",
                                    "You can't see the mirror in the lobby, grieving and white hair. It's as green as snow at dusk.",
                                    " Life must be full of joy. Don't make Jin Yuankong face to face with the moon. ",
                                    "Natural talent will be useful, thousands of gold scattered back. It takes 300 cups to cook sheep and slaughter cattle for pleasure. ",
                                    "Cen Fu Zi, Danqiusheng, will not stop drinking.",
                                    " Sing a song with you, please listen to it for me. ",
                                    "Zhonggu Xiaoyu is not expensive enough, I hope that long drunk will not wake up. ",
                                    "All sages and sages have been lonely since ancient times, but only drinkers have left their names. ",
                                    "In the past, King Chen enjoyed banquets and wine fights.",
                                    " Why does the owner say less money? ",
                                    "Five-colored horses, Qianjin Qiu ",
                                    "Huer will exchange fine wine and sell with Er for a long time"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionE = UIAlertAction.init(title: "《杂诗三首·其二》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《杂诗三首·其二》",
                                  "君自故乡来,应知故乡事。","来日绮窗前，寒梅著花未？"]
                pinVC.englishArr = ["Three Miscellaneous Poems","When you come from your hometown, you should know about it.",
                                    " In front of the window of tomorrow, the plum blossoms are not yet blooming"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionF = UIAlertAction.init(title: "《九月九日忆山东兄弟》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《九月九日忆山东兄弟》",
                                  "独在异乡为异客，每逢佳节倍思亲。","遥知兄弟登高处，遍插茱萸少一人"]
                pinVC.englishArr = ["Remembering Shandong Brothers on September 9","Alone in a foreign country, I miss my relatives every festival."," Far-away brothers ascend the heights, less than one person inserts dogwood everywhere"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            
            alertVC.addAction(actionA)
            alertVC.addAction(actionB)
            alertVC.addAction(actionC)
            alertVC.addAction(actionD)
            alertVC.addAction(actionE)
            alertVC.addAction(actionF)
            self.present(alertVC, animated: true, completion: nil)
//            let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
//
//            pinVC.hanziArr = ["怒发冲冠，凭栏处、潇潇雨歇。抬望眼，仰天长啸，壮怀激烈。三十功名尘与土，八千里路云和月。莫等闲，白了少年头，空悲切！靖康耻，犹未雪。臣子恨，何时灭！驾长车，踏破贺兰山缺。壮志饥餐胡虏肉，笑谈渴饮匈奴血。待从头、收拾旧山河，朝天阙",
//                              "驿外断桥边，寂寞开无主。已是黄昏独自愁，更著风和雨。无意苦争春，一任群芳妒。零落成泥碾作尘，只有香如故",
//                              "明月几时有？把酒问青天。不知天上宫阙，今夕是何年。我欲乘风归去，又恐琼楼玉宇，高处不胜寒。起舞弄清影，何似在人间？转朱阁，低绮户，照无眠。不应有恨，何事长向别时圆？人有悲欢离合，月有阴晴圆缺，此事古难全。但愿人长久，千里共婵娟",
//                              "风住尘香花已尽，日晚倦梳头。物是人非事事休，欲语泪先流。闻说双溪春尚好，也拟泛轻舟。只恐双溪舴艋舟，载不动许多愁",
//                              "人道有情须有梦，无梦岂无情？夜夜相思直到明，有梦怎生成？伊若忽然来梦里，邻笛又还惊。笛里声声不忍听，浑是断肠声",
//                              "水边沙外。城郭春寒退。花影乱，莺声碎。飘零疏酒盏，离别宽衣带。人不见，碧云暮合空相对。忆昔西池会。鹓鹭同飞盖。携手处，今谁在。日边清梦断，镜里朱颜改。春去也，飞红万点愁如海"]
//            pinVC.englishArr = ["Anger bursts into the crown, leaning against the railings, Xiaoyu rest. Looking up at the eyes, looking up at the sky, whistling, strong and intense. Thirty feats of fame and dust, eight thousand miles of clouds and months. Don't wait idle, white young head, empty sad! Jingkang shame, still not snow. The minister hates, when to extinguish! Drive a long car to break through the shortage of Helan Mountain. Ambition hungry meal Hu flesh, laughing about thirst for Hun blood. To start from scratch, clean up the old mountains and rivers, facing the sky.",
//                                "Outside the post, by the broken bridge, there is no owner left alone. It's dusk alone, more wind and rain. No intention of struggling for spring, a group of fragrant jealousy. Scattered into mud and ground into dust, only fragrant as ever",
//                                "When is the moon? Ask the sky for wine. I don't know what season it would be in the heavens on this night. I want to return by the wind, and fear the Qionglou Yuyu, the height of the cold. Dancing to figure out the shadow, what is it like in the world? The moon rounds the Red Mansion Stoops to silk-pad doors, Shines upon the sleepless Bearing no grudge. Why does the moon tend to be full when people are apart? People may have sorrow or joy, be near or far apart, the moon may be dim or bright, wax or wane, This has been going on since the beginning of time. May we all be blessed with longevity. Though far apart, we are still able to share the beauty of the moon together.",
//                                "The wind has exhausted the fragrant flowers and combed the hair day and night. Things are people who have nothing to do and want to cry first. It is said that Shuangxi Spring is still good and plans to go boating. For fear that the boats of the two streams will not carry much sorrow",
//                                "Humanity must have dreams when it is affectionate. Is it ruthless when it is not? Acacia at night until the Ming Dynasty, how do dreams come into being? If Ijo suddenly came to his dream, the next flute was still frightened. The voice in the flute can't bear to listen. It's a broken bowel.",
//                                "Outside the sand by the water. The city was cold in spring. Flowers and shadows are chaotic and warblers are broken. Drifting wine, leaving undress. People are missing, blue clouds and dusks are in the sky. Recalling the past, Xichi Club. The birds and herons fly together. Hand in hand, who is here today? The sun is clear and the dream is broken, and Zhu Yanchang is in the mirror. Spring is gone, flying red is like a sea of sorrow"]
//            pinVC.type = .宋词
//            self.navigationController?.pushViewController(pinVC, animated: true)
            break
        case 1017: //励志
            debugPrint("11")
            let alertVC = UIAlertController.init(title: "唐诗", message: "欢迎学习", preferredStyle: .alert)
            let actionA = UIAlertAction.init(title: "《早发白帝城》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《早发白帝城》","朝辞白帝彩云间","千里江陵一日还","两岸猿声啼不住","轻舟已过万重山",]
                pinVC.englishArr = ["Baidi City of Early Falling","Among the clouds of Emperor Bai", "Qianli Jiangling returned one day", "The boat passed thousands of mountains with apes shouting without endless","The boat passed thousands of mountains with apes shouting without endless"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionB = UIAlertAction.init(title: "《黄鹤楼送孟浩然之广陵》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = [
                    "《黄鹤楼送孟浩然之广陵》","故人西辞黄鹤楼","烟花三月下扬州。","孤帆远影碧空尽，","唯见长江天际流"]
                pinVC.englishArr = ["Huanghe Tower Sends Meng Haoran's Guangling","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible.","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible."]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionC = UIAlertAction.init(title: "《静夜思》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《静夜思》",
                                  "床前明月光","疑是地上霜","举头望明月","低头思故乡"]
                pinVC.englishArr = ["Quiet night thinking","The bright moonlight in front of the bed is suspected to be frost on the ground.","The bright moonlight in front of the bed is suspected to be frost on the ground","Raising my head, I see the moon so bright"," withdrawing my eyes, my nostalgia comes around",
                ]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionD = UIAlertAction.init(title: "《将进酒·君不见黄河之水天上来》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《将进酒·君不见黄河之水天上来》",
                                  "君不见黄河之水天上来，奔流到海不复回",
                                  "君不见高堂明镜悲白发，朝如青丝暮成雪",
                                  "人生得意须尽欢，莫使金樽空对月。",
                                  "天生我材必有用，千金散尽还复来。",
                                  "烹羊宰牛且为乐，会须一饮三百杯。",
                                  "岑夫子，丹丘生，将进酒，杯莫停。",
                                  "与君歌一曲，请君为我侧耳听。",
                                  "钟鼓馔玉不足贵，但愿长醉不复醒。",
                                  "古来圣贤皆寂寞，惟有饮者留其名。",
                                  "陈王昔时宴平乐，斗酒十千恣欢谑。",
                                  "主人何为言少钱，径须沽取对君酌。",
                                  "五花马，千金裘，",
                                  "呼儿将出换美酒，与尔同销万古愁"]
                pinVC.englishArr = ["Will Wine, Jun Can't See the Water of the Yellow River in Heaven",
                                    "You can't see the water of the Yellow River coming up from the sky, running to the sea and never returning. ",
                                    "You can't see the mirror in the lobby, grieving and white hair. It's as green as snow at dusk.",
                                    " Life must be full of joy. Don't make Jin Yuankong face to face with the moon. ",
                                    "Natural talent will be useful, thousands of gold scattered back. It takes 300 cups to cook sheep and slaughter cattle for pleasure. ",
                                    "Cen Fu Zi, Danqiusheng, will not stop drinking.",
                                    " Sing a song with you, please listen to it for me. ",
                                    "Zhonggu Xiaoyu is not expensive enough, I hope that long drunk will not wake up. ",
                                    "All sages and sages have been lonely since ancient times, but only drinkers have left their names. ",
                                    "In the past, King Chen enjoyed banquets and wine fights.",
                                    " Why does the owner say less money? ",
                                    "Five-colored horses, Qianjin Qiu ",
                                    "Huer will exchange fine wine and sell with Er for a long time"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionE = UIAlertAction.init(title: "《杂诗三首·其二》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《杂诗三首·其二》",
                                  "君自故乡来,应知故乡事。","来日绮窗前，寒梅著花未？"]
                pinVC.englishArr = ["Three Miscellaneous Poems","When you come from your hometown, you should know about it.",
                                    " In front of the window of tomorrow, the plum blossoms are not yet blooming"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionF = UIAlertAction.init(title: "《九月九日忆山东兄弟》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《九月九日忆山东兄弟》",
                                  "独在异乡为异客，每逢佳节倍思亲。","遥知兄弟登高处，遍插茱萸少一人"]
                pinVC.englishArr = ["Remembering Shandong Brothers on September 9","Alone in a foreign country, I miss my relatives every festival."," Far-away brothers ascend the heights, less than one person inserts dogwood everywhere"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            
            alertVC.addAction(actionA)
            alertVC.addAction(actionB)
            alertVC.addAction(actionC)
            alertVC.addAction(actionD)
            alertVC.addAction(actionE)
            alertVC.addAction(actionF)
            self.present(alertVC, animated: true, completion: nil)
        case 1018: //名人言
            let alertVC = UIAlertController.init(title: "唐诗", message: "欢迎学习", preferredStyle: .alert)
            let actionA = UIAlertAction.init(title: "《早发白帝城》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《早发白帝城》","朝辞白帝彩云间","千里江陵一日还","两岸猿声啼不住","轻舟已过万重山",]
                pinVC.englishArr = ["Baidi City of Early Falling","Among the clouds of Emperor Bai", "Qianli Jiangling returned one day", "The boat passed thousands of mountains with apes shouting without endless","The boat passed thousands of mountains with apes shouting without endless"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionB = UIAlertAction.init(title: "《黄鹤楼送孟浩然之广陵》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = [
                    "《黄鹤楼送孟浩然之广陵》","故人西辞黄鹤楼","烟花三月下扬州。","孤帆远影碧空尽，","唯见长江天际流"]
                pinVC.englishArr = ["Huanghe Tower Sends Meng Haoran's Guangling","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","The old man left the Yellow Crane Tower in the West and went to Yangzhou in March with fireworks","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible.","Solitary sails and distant shadows are empty, only the Yangtze River's skyline current is visible."]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionC = UIAlertAction.init(title: "《静夜思》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《静夜思》",
                                  "床前明月光","疑是地上霜","举头望明月","低头思故乡"]
                pinVC.englishArr = ["Quiet night thinking","The bright moonlight in front of the bed is suspected to be frost on the ground.","The bright moonlight in front of the bed is suspected to be frost on the ground","Raising my head, I see the moon so bright"," withdrawing my eyes, my nostalgia comes around",
                ]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionD = UIAlertAction.init(title: "《将进酒·君不见黄河之水天上来》·李白", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《将进酒·君不见黄河之水天上来》",
                                  "君不见黄河之水天上来，奔流到海不复回",
                                  "君不见高堂明镜悲白发，朝如青丝暮成雪",
                                  "人生得意须尽欢，莫使金樽空对月。",
                                  "天生我材必有用，千金散尽还复来。",
                                  "烹羊宰牛且为乐，会须一饮三百杯。",
                                  "岑夫子，丹丘生，将进酒，杯莫停。",
                                  "与君歌一曲，请君为我侧耳听。",
                                  "钟鼓馔玉不足贵，但愿长醉不复醒。",
                                  "古来圣贤皆寂寞，惟有饮者留其名。",
                                  "陈王昔时宴平乐，斗酒十千恣欢谑。",
                                  "主人何为言少钱，径须沽取对君酌。",
                                  "五花马，千金裘，",
                                  "呼儿将出换美酒，与尔同销万古愁"]
                pinVC.englishArr = ["Will Wine, Jun Can't See the Water of the Yellow River in Heaven",
                                    "You can't see the water of the Yellow River coming up from the sky, running to the sea and never returning. ",
                                    "You can't see the mirror in the lobby, grieving and white hair. It's as green as snow at dusk.",
                                    " Life must be full of joy. Don't make Jin Yuankong face to face with the moon. ",
                                    "Natural talent will be useful, thousands of gold scattered back. It takes 300 cups to cook sheep and slaughter cattle for pleasure. ",
                                    "Cen Fu Zi, Danqiusheng, will not stop drinking.",
                                    " Sing a song with you, please listen to it for me. ",
                                    "Zhonggu Xiaoyu is not expensive enough, I hope that long drunk will not wake up. ",
                                    "All sages and sages have been lonely since ancient times, but only drinkers have left their names. ",
                                    "In the past, King Chen enjoyed banquets and wine fights.",
                                    " Why does the owner say less money? ",
                                    "Five-colored horses, Qianjin Qiu ",
                                    "Huer will exchange fine wine and sell with Er for a long time"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionE = UIAlertAction.init(title: "《杂诗三首·其二》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《杂诗三首·其二》",
                                  "君自故乡来,应知故乡事。","来日绮窗前，寒梅著花未？"]
                pinVC.englishArr = ["Three Miscellaneous Poems","When you come from your hometown, you should know about it.",
                                    " In front of the window of tomorrow, the plum blossoms are not yet blooming"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            let actionF = UIAlertAction.init(title: "《九月九日忆山东兄弟》·王维", style: .default) { (btn) in
                let pinVC = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "XueXiVC")  as! XueXiVC
                
                pinVC.hanziArr = ["《九月九日忆山东兄弟》",
                                  "独在异乡为异客，每逢佳节倍思亲。","遥知兄弟登高处，遍插茱萸少一人"]
                pinVC.englishArr = ["Remembering Shandong Brothers on September 9","Alone in a foreign country, I miss my relatives every festival."," Far-away brothers ascend the heights, less than one person inserts dogwood everywhere"]
                pinVC.type = .唐诗
                self.navigationController?.pushViewController(pinVC, animated: true)
            }
            
            alertVC.addAction(actionA)
            alertVC.addAction(actionB)
            alertVC.addAction(actionC)
            alertVC.addAction(actionD)
            alertVC.addAction(actionE)
            alertVC.addAction(actionF)
            self.present(alertVC, animated: true, completion: nil)
        default:
            break
        }
    }
    
    @IBAction func readerHanzi(_ sender: UIButton) {
    
        
        let avspeach = AVSpeechSynthesizer.init()
        let utterance = AVSpeechUtterance.init(string: (sender.titleLabel?.text)!)
        avspeach.speak(utterance)
        
    }
   
}

